package com.lxinet.jeesns.modules.wechat.service.impl;

import com.lxinet.jeesns.core.dto.ResponseModel;
import com.lxinet.jeesns.core.entity.Page;
import com.lxinet.jeesns.modules.wechat.dao.IWechatRecordDao;
import com.lxinet.jeesns.modules.wechat.entity.RowMsg;
import com.lxinet.jeesns.modules.wechat.entity.WechatRecord;
import com.lxinet.jeesns.modules.wechat.service.IWechatRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by lzs on 2017/4/11.
 */
@Service("wechatRecordService")
public class WechatRecordServiceImpl implements IWechatRecordService{

    @Resource
    private IWechatRecordDao wechatRecordDao;

    @Override
    public List<WechatRecord> findRecords(String wxuin, String username) {

        return wechatRecordDao.findRecords(wxuin,username);
    }

    @Override
    public List<WechatRecord> findZDMsg(String formusername, String tousername) {
        return wechatRecordDao.findZDMsg(formusername,tousername);
    }

    @Override
    public void changeFlag(Integer id) {
         wechatRecordDao.changeFlag(id);
    }

    @Override
    public int save(WechatRecord wechatRecord) {
        return wechatRecordDao.save(wechatRecord);
    }

    @Override
    public WechatRecord findByCondition(String formusername, String tousername, String msgid) {
        return wechatRecordDao.findByCondition(formusername,tousername,msgid);
    }

    @Override
    public int getCount(String username) {
        return wechatRecordDao.count(username);
    }

    @Override
    public List<RowMsg> Conditioncount(String tousername) {
        return wechatRecordDao.Conditioncount(tousername);
    }

    @Override
    public int getCountByNickName(String nickname) {
            return wechatRecordDao.getCountByNickName(nickname);
    }

    @Override
    public ResponseModel findOldMsgByPage(Page page, String formusername, String tousername) {
        ResponseModel model = new ResponseModel(0,page);
        List list = wechatRecordDao.findOldMsgByPage(page,formusername,tousername);
        model.setData(list);
        return model;
    }


}
